package com.aids_malaria.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.aids_malaria.R;
import com.aids_malaria.base.BaseQuickAdapter;
import com.aids_malaria.base.BaseViewHolder;
import com.aids_malaria.http.response.MedicalTreatment;
import com.aids_malaria.ui.datacollect.DataQueryActivity;

import java.util.List;

public class MedicalTreatmentAdapter extends BaseQuickAdapter<MedicalTreatment> {

    private Context context;

    public MedicalTreatmentAdapter(Context context, int layoutResID, List<MedicalTreatment> data) {
        super(context, layoutResID, data);
        this.context = context;
    }

    @Override
    public void convert(BaseViewHolder holder, MedicalTreatment item) {
        if (holder.getAdapterPosition() % 2 > 0){
            holder.getView(R.id.item).setBackgroundColor(context.getResources().getColor(R.color.c_item2));
        }else {
            holder.getView(R.id.item).setBackgroundColor(context.getResources().getColor(R.color.c_item1));
        }

        holder.setText(R.id.tv_village_name,item.getArea_name());
        holder.setText(R.id.tv_person_num,item.getPerson_sum());
        holder.setText(R.id.tv_take_medical_num,item.getTake_medicine_num());
        holder.setText(R.id.tv_pregnant_3_num,item.getPregnant_3_num());
        holder.setText(R.id.tv_take_medical_rate,item.getMedication_rate());
    }
}
